#!/bin/bash
ES_HOME=`pwd`
curl -OL https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.zip

unzip ./elasticsearch-1.3.4.zip

./bin/plugin --install jdbc --url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/1.3.4.4/elasticsearch-river-jdbc-1.3.4.4-plugin.zip

curl -o mysql-connector-java-5.1.33.zip -L 'http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.33.zip/from/http://cdn.mysql.com/'
unzip mysql-connector-java-5.1.33.zip

cp ./mysql-connector-java-5.1.33/mysql-connector-java-5.1.33-bin.jar  $ES_HOME/plugins/jdbc/ 

chmod 644 $ES_HOME/plugins/jdbc/*
wget https://codeload.github.com/elasticsearch/elasticsearch-servicewrapper/zip/master
unzip elasticsearch-servicewrapper.zip
cd ./elasticsearch-servicewrapper-master\elasticsearch-servicewrapper-master
cp -r ./service $ES_HOME/bin


#./bin/elasticsearch -d
